package jm.nj.demo14mian.demo01;

import java.net.InetAddress;
import java.net.UnknownHostException;

/*
* InetAdderss类,该类封装一个IP地址
* 并提供一系列ip方法
* */
public class demoInetAddress {
    public static void main(String[] args) throws UnknownHostException {
        InetAddress Local = InetAddress.getLocalHost();
        InetAddress remote = InetAddress.getByName("www.itcast.cn");
        System.out.println("本机的IP地址:"+ Local.getHostAddress());
        System.out.println("itcast的IP地址"+remote.getHostAddress());
        System.out.println("itcast的主机名"+remote.getHostName());

    }
}
